package com.livgo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.livgo.dao.po.FileInfo;
import com.livgo.dao.vo.FileInfoVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface FileMapper extends BaseMapper<FileInfo> {

    @Insert("insert into file_info(code,ori_name,file_name,uri,type,max_count,current_count,expire_time,file_size,extension,upload_time,status) values(#{code},#{oriName},#{fileName},#{uri},#{type},#{maxCount},#{currentCount},#{expireTime},#{fileSize},#{extension},#{uploadTime},#{status})")
    void upload(FileInfo info);

    @Select("select * from file_info where status = 0 and type = 2")
    List<FileInfoVo> listPage();

    @Select("select * from file_info where code = #{code} and status = 0")
    FileInfoVo info(String code);
}
